﻿@{
    var blogUser = ViewBag.blogUser as AccountModel;
    ViewBag.Title = blogUser.NickName + "的动态 - 小博客";
    Layout = "~/Views/Shared/_BlogLayout.cshtml";

    var careMe = ViewBag.careMe as List<ConcernModel>;
    var careUser = ViewBag.careUser as List<ConcernModel>;
    var notices = ViewBag.notices as List<NoticeModel>;
}
@using MyBlog
<div style="padding:5px">
    <div class="user-center-title">
        @(UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account) ? "我的动态" : blogUser.NickName + "的动态")
    </div>
    <div id="userTab" class="tab-container">
        <ul class='etabs'>
            <li class='tab'><a href="#tab1">博客最新动态</a></li>
            <li class='tab'><a href="#tab2">@(UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account) ? "我关注的人" : blogUser.NickName + "关注的人")(@careUser.Default().Count())</a></li>
            <li class='tab'><a href="#tab3">@(UserSession.LoginUserInfo != null && UserSession.AccountId.Same(blogUser.Account) ? "我的粉丝" : blogUser.NickName + "的粉丝")(@careMe.Default().Count())</a></li>
        </ul>
        <div class="panel-container">
            <div id="tab1">
                @if (notices.Default().Count() == 0)
            {
                    <span class="dv-none-tip">暂无动态~</span>
            }
            else
            {
                    <ul>
                        @foreach (var item in notices)
                {
                            <li>
                                <div class="notice-main">
                                    <div class="notice-head">
                                        @if (item.Account.HeadId.HasValue && item.Account.HeadId.Value > 0)
                                    {
                                            <img class="imghead65" src="@Url.Action("GetUserHeadByUid", "account", new { uid = item.NoticeUID })">
                                    }
                                    else
                                    {
                                            <img class="imghead65" src="~/Content/Images/zanwutouxiang.jpg" />
                                    }
                                    </div>
                                    <div class="notice-body">
                                        <p>
                                            <span class="sptime">@item.NoticeTime.ToString("yyyy年MM月dd日 HH时mm分ss秒")</span>
                                            <span class="spuid">@item.Account.NickName</span>
                                            <span>@item.NoticeEnum.GetNoticeString()：@Html.Raw(item.NoticeLink)</span>
                                        </p>
                                        <p>@item.NoticeContent</p>
                                    </div>
                                </div>
                            </li>
                    }
                    </ul>
            }
            </div>
            <div id="tab2">
                <ul class="concer-ul">
                    @foreach (var item in careUser.Default())
                {
                        <li>
                            <div>
                                <a href="@Url.Content("~/"+item.ConcernUID)" title="进入@(item.ConcernUser.NickName)的博客">
                                    @if (item.ConcernUser.HeadId.HasValue && item.ConcernUser.HeadId.Value > 0)
                                {
                                        <img class="imghead100" src="@Url.Action("GetUserHeadByUid", "account", new { uid = item.ConcernUID })" />
                                }
                                else
                                {
                                        <img class="imghead100" src="~/Content/Images/zanwutouxiang.jpg" />
                                }
                                </a>
                            </div>
                            <div class="concer-nick"><i class="icon-user"></i> <a href="@Url.Content("~/"+item.ConcernUID)">@item.ConcernUser.NickName</a></div>
                            <div class="concer-bottom"><a target="_blank" href="@Url.Content("~/"+item.ConcernUID+"/blog/usercenter")">去看看他的动态<i class="icon-circle-arrow-right"></i></a></div>
                        </li>
                }
                </ul>
            </div>
            <div id="tab3">
                <ul class="concer-ul">
                    @foreach (var item in careMe.Default())
                {
                        <li>
                            <div>
                                <a href="@Url.Content("~/"+item.UID)" title="进入@(item.Account.NickName)的博客">
                                    @if (item.Account.HeadId.HasValue && item.Account.HeadId.Value > 0)
                                {
                                        <img class="imghead100" src="@Url.Action("GetUserHeadByUid", "account", new { uid = item.UID })" />
                                }
                                else
                                {
                                        <img class="imghead100" src="~/Content/Images/zanwutouxiang.jpg" />
                                }
                                </a>
                            </div>
                            <div class="concer-nick"><i class="icon-user"></i> <a href="@Url.Content("~/"+item.UID)">@item.Account.NickName</a></div>
                            <div class="concer-bottom"><a target="_blank" href="@Url.Content("~/"+item.UID+"/blog/usercenter")">去看看他的动态<i class="icon-circle-arrow-right"></i></a></div>
                        </li>
                }
                </ul>
            </div>
        </div>
    </div>
</div>
<link href="~/Content/Blog/concern.css" rel="stylesheet" />
<script type="text/javascript">
    $(function () {
        $('#userTab').easytabs();
        if (location.href.lastIndexOf('#') > 0) {
            var mid = location.href.substring(location.href.lastIndexOf('#'));
            mid == "#1" ? $('#userTab').easytabs('select', '#tab1') : mid == "#2" ? $('#userTab').easytabs('select', '#tab2') : $('#userTab').easytabs('select', '#tab3');
            //$('html,body').animate({ scrollTop: 0 }, 10);
        }
    })
</script>